import React from "react";
import "../css/Header.css";

class Header extends React.Component {
    // 构造函数
    constructor() {
        // 调用父类的构造函数
        super();
        this.state = {
            data:["新闻","hao123","地图","视频","贴吧","学术","更多"]
        }
    }
    // 渲染
    render() {
        return (
            <div className="header">
                <div className="header-list">
                    {
                        this.state.data.map((element,index) => {
                            return <div key={index} onClick={()=>{
                                alert(element)
                            }}>{element}</div>
                        })
                    }
                </div>
                <div className="header-container">
                    <div className="header-container-img">
                        <img src="baidu.png" />
                    </div>
                    <div className="header-container-box">
                        <input />
                        <button>百度一下</button>
                    </div>
                </div>
            </div>
        );
    }
}

export default Header;
